﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:view="clr-namespace:PasswordProvider.View">
    
    <SolidColorBrush x:Key="WindowBrush">White</SolidColorBrush>
    <SolidColorBrush x:Key="ForegroundBrush">Black</SolidColorBrush>

    <Color x:Key="DetailColorLight">#FFF4F6FA</Color>
    <Color x:Key="DetailColor">#FFD1D6DF</Color>
    <Color x:Key="DetailColorDark">#FF58606F</Color>
    
    <Color x:Key="DetailActiveColorLight">#FFDBE1E7</Color>
    <Color x:Key="DetailActiveColor">#FF3399FF</Color>
    <Color x:Key="DetailActiveColorDark">#FF0057AF</Color>         
    
    <Color x:Key="PageGradientColor1">#FFECECF1</Color>
    <Color x:Key="PageGradientColor2">#FFF9F9FE</Color>
    
    <SolidColorBrush x:Key="DetailBrush" Color="{DynamicResource DetailColor}"/>
    <SolidColorBrush x:Key="DetailBrushLight" Color="{DynamicResource DetailColorLight}" />
    <SolidColorBrush x:Key="DetailBrushDark" Color="{DynamicResource DetailColorDark}" />
    <SolidColorBrush x:Key="DetailActiveBrush" Color="{DynamicResource DetailActiveColor}" />
    <SolidColorBrush x:Key="DetailActiveBrushLight" Color="{DynamicResource DetailActiveColorLight}" />
    <SolidColorBrush x:Key="DetailActiveBrushDark" Color="{DynamicResource DetailActiveColorDark}" />
    <SolidColorBrush x:Key="DetailInactiveBrush" Color="{DynamicResource DetailInactiveColor}" />

    <LinearGradientBrush x:Key="ActiveButtonBrush" StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#FFF2F2FF" Offset="0.15" />
            <GradientStop Color="#FFE9E9F6" Offset=".5" />
            <GradientStop Color="#FFD6D6E8" Offset=".5" />
            <GradientStop Color="#FFD3D3E8" Offset="1" />
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="ActiveBorderBrush" StartPoint="0,0" EndPoint="0,20" MappingMode="Absolute">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#FF0057AF" Offset="0.05" />
            <GradientStop Color="#FF7CADDD" Offset="0.07" />
            <GradientStop Color="#FF7CADDD" Offset="1" />
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="MenuBackground" StartPoint="0,0.5" EndPoint="1,0.5">
        <GradientStop Color="#FFBDBDCB" Offset="0"/>
        <GradientStop Color="#FFECECF1" Offset="1" />
    </LinearGradientBrush >
    <SolidColorBrush x:Key="MenuForeground" Color="Black" />

    <!-- Style for the enter password page -->
    <Style TargetType="{x:Type view:EnterPasswordPage}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0.35,0" EndPoint="0.65,1">
                    <GradientStop Color="#FF000000" Offset="0.30"/>
                    <GradientStop Color="#FFDCE2E7" Offset="1" />
                </LinearGradientBrush >
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Style for the help reader window -->
    <Style TargetType="{x:Type view:HelpReader}">
        <Setter Property="Foreground" Value="White" />
        <Setter Property="BorderBrush" Value="#FF003468" />            
    </Style>

    <!-- Style for the main window -->
    <Style TargetType="{x:Type view:MainWindow}">
        <!--Background inherited by all pages displayed inside the main window, unless overridden. -->
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="{DynamicResource PageGradientColor1}" Offset="0.35"/>
                    <GradientStop Color="{DynamicResource PageGradientColor2}" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- Background Brush for an active tab item -->
    <SolidColorBrush x:Key="ActiveTabItemBackgroundBrush" Color="{DynamicResource PageGradientColor1}" />    
    
    <!-- Background Brush for an inactive tab item -->
    <LinearGradientBrush x:Key="InactiveTabItemBackgroundBrush">
        <GradientStop Color="LightGray" Offset="0" />
        <GradientStop Color="{DynamicResource PageGradientColor1}" Offset="1"/>        
    </LinearGradientBrush>

    <!-- Style for the list box group header. -->
    <Style x:Key="ListBoxGroupHeaderStyle">
        <Setter Property="TextBox.Foreground" Value="{DynamicResource DetailBrushDark}" />
        <Setter Property="TextBox.FontWeight" Value="Bold" />
    </Style>

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="Background" Value="{DynamicResource WindowBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="AllowDrop" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            Background="{TemplateBinding Background}" 
                            SnapsToDevicePixels="true">
                        <ScrollViewer Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource DetailBrush}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource ActiveBorderBrush}" />                            
                        </Trigger>
                        <Trigger Property="IsKeyboardFocusWithin" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource DetailActiveBrushDark}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!-- Style for the standard password box -->
    <Style TargetType="{x:Type PasswordBox}">
        <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />        
    </Style>
    
    <Style TargetType="GroupBox">
        <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
    </Style>

    <Style TargetType="Button">
        <Setter Property="Height" Value="23"/>
        <Setter Property="Foreground" Value="{DynamicResource Foreground}" />
        <Setter Property="Background" Value="{DynamicResource DetailBrushLight}" />
        <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <Border Name="border"  
                                SnapsToDevicePixels="True"
                                Height="{TemplateBinding Height}"  
                                MinWidth="{TemplateBinding MinWidth}"
                                MinHeight="{TemplateBinding MinHeight}"
                                CornerRadius="3"
                                BorderThickness="1" 
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Background="{TemplateBinding Background}">

                            <Border Name="innerBorder" Padding="3,0"
                                SnapsToDevicePixels="True" 
                                Background="Transparent" 
                                BorderThickness="1" 
                                BorderBrush="Transparent">
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <Viewbox Name="viewBoxBackward" SnapsToDevicePixels="True" Margin="0,5,4,5" Visibility="Collapsed">
                                        <Path Name="pathBack" Fill="{TemplateBinding Foreground}" Data="M 0,1 L 1,0 L 1,2 Z" />
                                    </Viewbox>
                                    <TextBlock Name="textBlock" SnapsToDevicePixels="True" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" Text="{TemplateBinding Content}" />                            
                                    <Viewbox Name="viewBoxForward" Margin="4,5,0,5" Visibility="Collapsed">
                                        <Path Name="pathForward" Fill="{TemplateBinding Foreground}" Data="M 0,0 L 1,1 L 0,2 Z" />
                                    </Viewbox>
                                    
                                </StackPanel>
                            </Border>
                        </Border>


                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Tag" Value="Forward">
                            <Setter TargetName="viewBoxForward" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="Tag" Value="Backward">
                            <Setter TargetName="viewBoxBackward" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="{DynamicResource DetailActiveBrushDark}" />
                            <Setter Property="Background" Value="{DynamicResource ActiveButtonBrush}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource DetailActiveBrushDark}" />
                        </Trigger>                        
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="{DynamicResource DetailActiveBrushDark}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{DynamicResource DetailBrushLight}" />
                            <Setter Property="Foreground" Value="{DynamicResource DetailBrush}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    
    <!-- Style for a tab control -->
    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Background"
                Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Control}}, Path=Background}"	/>
        
        <Setter Property="BorderThickness" Value="0" />
    </Style>

    <!-- Style for a tab item -->
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="BorderBrush" Value="{DynamicResource DetailBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border
                            Name="Border" Margin="0,0,-4,0"
                            BorderThickness="1"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            CornerRadius="2,12,0,0" >
                            <ContentPresenter x:Name="ContentSite"                                              
                                  VerticalAlignment="Center"
                                  HorizontalAlignment="Center"
                                  ContentSource="Header"
                                  Margin="12,2,12,2"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ActiveTabItemBackgroundBrush}" />
                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                            <Setter TargetName="ContentSite"  Property="TextBlock.FontWeight" Value="Bold" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource InactiveTabItemBackgroundBrush}"  />
                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,1" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>